package cn.app.android.sichuanxiaoke.com.xiaokeapp.fragment;

import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

import cn.app.android.sichuanxiaoke.com.xiaokeapp.R;
import cn.app.android.sichuanxiaoke.com.xiaokeapp.adapter.MyTitleAdapter;

/**
 * Created by weian on 2017/8/18.
 */

public class ClassifyFragment extends Fragment {
    private EditText mSearchEtInput2;
    private ListView mTitle;
    private ListView mContent;
    private List<String> title;
    private MyTitleAdapter adapter;
    private WebView webView;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.classify_fragment, container, false);
        /*webView= (WebView) view.findViewById(R.id.webview);
        WebSettings settings = webView.getSettings();
        settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
        settings.setSupportZoom(true);
        webView.loadUrl("http://112.74.173.191/index.php/mobile");*/
        return view;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        initView();
    }

    private void initView() {
        mTitle = (ListView) getView().findViewById(R.id.title);
//        mContent = (ListView) getView().findViewById(R.id.content);
        initData();
        adapter = new MyTitleAdapter(getContext(),title);
        mTitle.setAdapter(adapter);
        mTitle.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {

            }
        });

    }

    private void initData() {
        title = new ArrayList<>();
        title.add("推荐分类");
        title.add("潮流女装");
        title.add("品牌男装");
        title.add("个人护肤");
        title.add("家用电器");
        title.add("电脑办公");
        title.add("手机数码");
        title.add("母婴童装");
        title.add("影响图书");
        title.add("影响图书");
        title.add("影响图书");
    }
}
